"""
    dbAccess.py - Allows access to the database
    Copyright (C) 2009  Matthew Baldwin <secretagentcook@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>
"""
from sqlalchemy import create_engine,  MetaData,  Table
from sqlalchemy.orm import mapper,  sessionmaker

class Access(object):

    engine = create_engine('sqlite:///world.sqlite')
    metadata = MetaData(engine)
    Session = sessionmaker(bind=engine)
    #self.session = self.Session()
        
    class Players(object):
        def __init__(self, name, password):
            self.name = name
            self.password = password

    class Rooms(object):
        def __init__(self, number, name,  desc, exits, items, players):
            self.number = number
            self.name = name
            self.desc = desc
            self.exits = exits
            self.items = items
            self.players = players

    players_table = Table('players', metadata, autoload=True)
    mapper(Players, players_table)

    room_table = Table('rooms', metadata, autoload=True)
    mapper(Rooms, room_table)

